import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import Hospital from '@/views/Hospital.vue'
import Help from '@/views/Help.vue'
import Register from '@/views/hospital/Register.vue'
import Detail from '@/views/hospital/Detail.vue'
import Notice from '@/views/hospital/Notice.vue'
import Close from '@/views/hospital/Close.vue'
import Search from '@/views/hospital/Search.vue'

const useRouter = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/home' },
    { name: 'home', path: '/home', component: Home },
    { name: 'help', path: '/help', component: Help },
    {
      name: 'hospital',
      path: '/hospital',
      component: Hospital,
      children: [
        { name: 'register', path: 'register', component: Register },
        { name: 'detail', path: 'detail', component: Detail },
        { name: 'notice', path: 'notice', component: Notice },
        { name: 'close', path: 'close', component: Close },
        { name: 'search', path: 'search', component: Search },
        { name: 'registerStep1', path: 'register_step1', component: () => import('@/views/hospital/registerSteps/Register_step1.vue') },
        { name: 'registerStep2', path: 'register_step2', component: () => import('@/views/hospital/registerSteps/Register_step2.vue') },
      ]
    },
    {
      name: 'user',
      path: '/user',
      component: () => import('@/views/user/index.vue'),
      children: [
        { name: 'certification', path: 'certification', component: () => import('@/views/user/certification.vue') },
        { name: 'order', path: 'order', component: () => import('@/views/user/order.vue') },
        { name: 'patient', path: 'patient', component: () => import('@/views/user/patient.vue') },
        { name: 'profile', path: 'profile', component: () => import('@/views/user/profile.vue') },
        { name: 'feedback', path: 'feedback', component: () => import('@/views/user/feedback.vue') }
      ]
    },
  ],
})

export default useRouter
